<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>MiXiM: JakesFading Class Reference</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>


</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">MiXiM
   &#160;<span id="projectnumber">2.3</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="inherits.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('a00114.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pro-attribs">Protected Attributes</a> &#124;
<a href="#pri-methods">Private Member Functions</a> &#124;
<a href="#friends">Friends</a>  </div>
  <div class="headertitle">
<div class="title">JakesFading Class Reference<div class="ingroups"><a class="el" href="a00511.html">analogueModels - AnalogueModel implementations</a></div></div>  </div>
</div>
<div class="contents">
<!-- doxytag: class="JakesFading" --><!-- doxytag: inherits="AnalogueModel" -->
<p>Implements Rayleigh fading after Jakes' model.  
 <a href="a00114.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="a00398_source.html">JakesFading.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for JakesFading:</div>
<div class="dyncontent">
<div class="center"><img src="a00798.png" border="0" usemap="#JakesFading_inherit__map" alt="Inheritance graph"/></div>
<center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div>
<div class="dynheader">
Collaboration diagram for JakesFading:</div>
<div class="dyncontent">
<div class="center"><img src="a00799.png" border="0" usemap="#JakesFading_coll__map" alt="Collaboration graph"/></div>
<center><span class="legend">[<a target="top" href="graph_legend.html">legend</a>]</span></center></div>

<p><a href="a00800.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a5a41471badf18809757c3385eee4fc96"></a><!-- doxytag: member="JakesFading::JakesFading" ref="a5a41471badf18809757c3385eee4fc96" args="()" -->
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00114.html#a5a41471badf18809757c3385eee4fc96">JakesFading</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Default constructor for the model, the initialization will be done in initFromMap. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00114.html#a5195d855a7219f5c3c4a953997b37084">initFromMap</a> (const <a class="el" href="a00009.html#ab1820eb5285a02a2464be54ec651feab">ParameterMap</a> &amp;)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialize the analog model from XML map data.  <a href="#a5195d855a7219f5c3c4a953997b37084"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00114.html#a9674a1930ca4ca810b79665f20968a62">filterSignal</a> (airframe_ptr_t, const <a class="el" href="a00065.html">Coord</a> &amp;, const <a class="el" href="a00065.html">Coord</a> &amp;)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Has to be overriden by every implementation.  <a href="#a9674a1930ca4ca810b79665f20968a62"></a><br/></td></tr>
<tr><td colspan="2"><h2><a name="pro-attribs"></a>
Protected Attributes</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ad28b3b2fd11307bf33869c5bbdd27a95"></a><!-- doxytag: member="JakesFading::fadingPaths" ref="ad28b3b2fd11307bf33869c5bbdd27a95" args="" -->
int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00114.html#ad28b3b2fd11307bf33869c5bbdd27a95">fadingPaths</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Number of fading paths used. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a7f9a358fb5cdfd19e6d1e7c97627ad4f"></a><!-- doxytag: member="JakesFading::angleOfArrival" ref="a7f9a358fb5cdfd19e6d1e7c97627ad4f" args="" -->
double *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00114.html#a7f9a358fb5cdfd19e6d1e7c97627ad4f">angleOfArrival</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Angle of arrival on a fading path used for Doppler shift calculation. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a2f0c52cb4f441a2abba9aec17194fb66"></a><!-- doxytag: member="JakesFading::delay" ref="a2f0c52cb4f441a2abba9aec17194fb66" args="" -->
simtime_t *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00114.html#a2f0c52cb4f441a2abba9aec17194fb66">delay</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Delay on a fading path. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a8c91a22de8e520176877f7421d033ae7"></a><!-- doxytag: member="JakesFading::carrierFrequency" ref="a8c91a22de8e520176877f7421d033ae7" args="" -->
double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00114.html#a8c91a22de8e520176877f7421d033ae7">carrierFrequency</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Carrier frequency to be used. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa15d56a2dadede1a0432103d60d6d927"></a><!-- doxytag: member="JakesFading::interval" ref="aa15d56a2dadede1a0432103d60d6d927" args="" -->
<a class="el" href="a00013.html">Argument</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00114.html#aa15d56a2dadede1a0432103d60d6d927">interval</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The interval to set attenuation entries in. <br/></td></tr>
<tr><td colspan="2"><h2><a name="pri-methods"></a>
Private Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a7dc4b4b3a51c8e00b4c8cf5223d51547"></a><!-- doxytag: member="JakesFading::JakesFading" ref="a7dc4b4b3a51c8e00b4c8cf5223d51547" args="(const JakesFading &amp;)" -->
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00114.html#a7dc4b4b3a51c8e00b4c8cf5223d51547">JakesFading</a> (const <a class="el" href="a00114.html">JakesFading</a> &amp;)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Copy constructor is not allowed. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a71d2fb721f941e0f98fc31c3e609dbd4"></a><!-- doxytag: member="JakesFading::operator=" ref="a71d2fb721f941e0f98fc31c3e609dbd4" args="(const JakesFading &amp;)" -->
<a class="el" href="a00114.html">JakesFading</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="a00114.html#a71d2fb721f941e0f98fc31c3e609dbd4">operator=</a> (const <a class="el" href="a00114.html">JakesFading</a> &amp;)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Assignment operator is not allowed. <br/></td></tr>
<tr><td colspan="2"><h2><a name="friends"></a>
Friends</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a512ebf4ce5a76e1580f7058c9fd49d90"></a><!-- doxytag: member="JakesFading::JakesFadingMapping" ref="a512ebf4ce5a76e1580f7058c9fd49d90" args="" -->
class&#160;</td><td class="memItemRight" valign="bottom"><b>JakesFadingMapping</b></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>Implements Rayleigh fading after Jakes' model. </p>
<p>An example config.xml for this <a class="el" href="a00009.html" title="Interface for the analogue models of the physical layer.">AnalogueModel</a> can be the following: </p>
<div class="fragment"><pre class="fragment">
	&lt;AnalogueModel type="JakesFading"&gt;
		&lt;!-- Carrier frequency of the signal in Hz
			 If ommited the carrier frequency from the
			 connection manager is taken if available
			 otherwise set to default frequency of 2.412e+9--&gt;
		&lt;parameter name="carrierFrequency" type="double" value="2.412e+9"/&gt;

		&lt;!-- Number of fading paths per host --&gt;
		&lt;parameter name="fadingPaths" type="long" value="3"/&gt;

		&lt;!-- f-selectivity: mean delay spread in seconds --&gt;
		&lt;parameter name="delayRMS" type="double" value="0.0001"/&gt;

		&lt;!-- Interval in which to define attenuation for in seconds --&gt;
		&lt;parameter name="interval" type="double" value="0.001"/&gt;
	&lt;/AnalogueModel&gt;
   </pre></div><dl class="author"><dt><b>Author:</b></dt><dd>Hermann S. Lichte, Karl Wessel (port for MiXiM) </dd></dl>
</div><hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="a9674a1930ca4ca810b79665f20968a62"></a><!-- doxytag: member="JakesFading::filterSignal" ref="a9674a1930ca4ca810b79665f20968a62" args="(airframe_ptr_t, const Coord &amp;, const Coord &amp;)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void JakesFading::filterSignal </td>
          <td>(</td>
          <td class="paramtype">airframe_ptr_t&#160;</td>
          <td class="paramname"><em>frame</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="a00065.html">Coord</a> &amp;&#160;</td>
          <td class="paramname"><em>sendersPos</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const <a class="el" href="a00065.html">Coord</a> &amp;&#160;</td>
          <td class="paramname"><em>receiverPos</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Has to be overriden by every implementation. </p>
<p>Filters a specified AirFrame's <a class="el" href="a00192.html" title="The signal class stores the physical representation of the signal of an AirFrame.">Signal</a> by adding an attenuation over time to the <a class="el" href="a00192.html" title="The signal class stores the physical representation of the signal of an AirFrame.">Signal</a>.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">frame</td><td>The incomming frame. </td></tr>
    <tr><td class="paramname">sendersPos</td><td>The position of the frame sender. </td></tr>
    <tr><td class="paramname">receiverPos</td><td>The position of frame receiver. </td></tr>
  </table>
  </dd>
</dl>

<p>Implements <a class="el" href="a00009.html#a3242bc36a68dab53551d4ab1f1dab010">AnalogueModel</a>.</p>

<p>References <a class="el" href="a00192.html#a0beeef0f27c33145a0fca521df1c5f5c">Signal::addAttenuation()</a>, <a class="el" href="a00192.html#a2875223239e124d85949e1116cc12ae9">Signal::getReceptionEnd()</a>, <a class="el" href="a00192.html#a7c4710243cf87caf7dfc9f313e2619b2">Signal::getReceptionStart()</a>, and <a class="el" href="a00114.html#aa15d56a2dadede1a0432103d60d6d927">interval</a>.</p>
<div class="fragment"><pre class="fragment">{
  <a class="code" href="a00192.html" title="The signal class stores the physical representation of the signal of an AirFrame.">Signal</a>&amp;                signal           = frame-&gt;getSignal();
  ChannelMobilityPtrType senderMobility   = <span class="keyword">dynamic_cast&lt;</span><a class="code" href="a00053.html" title="Basic class for all physical layers, please don&#39;t touch!!">ConnectionManagerAccess</a> *<span class="keyword">&gt;</span>(frame-&gt;getSenderModule())-&gt;getMobilityModule();
  ChannelMobilityPtrType receiverMobility = <span class="keyword">dynamic_cast&lt;</span><a class="code" href="a00053.html" title="Basic class for all physical layers, please don&#39;t touch!!">ConnectionManagerAccess</a> *<span class="keyword">&gt;</span>(frame-&gt;getArrivalModule())-&gt;getMobilityModule();
  <span class="keyword">const</span> <span class="keywordtype">double</span>           relSpeed         = (senderMobility-&gt;getCurrentSpeed() - receiverMobility-&gt;getCurrentSpeed()).length();

  signal.<a class="code" href="a00192.html#a0beeef0f27c33145a0fca521df1c5f5c" title="Adds a function representing an attenuation of the signal.">addAttenuation</a>(<span class="keyword">new</span> <a class="code" href="a00115.html" title="Mapping used to represent attenuation of a signal by JakesFading.">JakesFadingMapping</a>(<span class="keyword">this</span>, relSpeed,
                                               <a class="code" href="a00013.html" title="Defines an argument for a mapping.">Argument</a>(signal.<a class="code" href="a00192.html#a7c4710243cf87caf7dfc9f313e2619b2" title="Returns the point in time when the receiving of the Signal started at the receiver module...">getReceptionStart</a>()),
                                               <a class="code" href="a00114.html#aa15d56a2dadede1a0432103d60d6d927" title="The interval to set attenuation entries in.">interval</a>,
                                               <a class="code" href="a00013.html" title="Defines an argument for a mapping.">Argument</a>(signal.<a class="code" href="a00192.html#a2875223239e124d85949e1116cc12ae9" title="Returns the point in time when the receiving of the Signal ended at the receiver module. Already includes the propagation delay.">getReceptionEnd</a>())));
}
</pre></div>
</div>
</div>
<a class="anchor" id="a5195d855a7219f5c3c4a953997b37084"></a><!-- doxytag: member="JakesFading::initFromMap" ref="a5195d855a7219f5c3c4a953997b37084" args="(const ParameterMap &amp;)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool JakesFading::initFromMap </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="a00009.html#ab1820eb5285a02a2464be54ec651feab">ParameterMap</a> &amp;&#160;</td>
          <td class="paramname"><em>params</em></td><td>)</td>
          <td><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Initialize the analog model from XML map data. </p>
<p>This method should be defined for generic analog model initialization.</p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table class="params">
    <tr><td class="paramname">params</td><td>The parameter map which was filled by XML reader.</td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>true if the initialization was successfully. </dd></dl>

<p>Reimplemented from <a class="el" href="a00009.html#a9c52493cdf1baa4110a83869e8bc13c5">AnalogueModel</a>.</p>

<p>References <a class="el" href="a00114.html#a7f9a358fb5cdfd19e6d1e7c97627ad4f">angleOfArrival</a>, <a class="el" href="a00114.html#a8c91a22de8e520176877f7421d033ae7">carrierFrequency</a>, <a class="el" href="a00114.html#a2f0c52cb4f441a2abba9aec17194fb66">delay</a>, <a class="el" href="a00114.html#ad28b3b2fd11307bf33869c5bbdd27a95">fadingPaths</a>, and <a class="el" href="a00114.html#aa15d56a2dadede1a0432103d60d6d927">interval</a>.</p>
<div class="fragment"><pre class="fragment">                                                        {
    ParameterMap::const_iterator it;
    <span class="keywordtype">bool</span>                         bInitSuccess = <span class="keyword">true</span>;
    <span class="keywordtype">double</span>                       delayRMS     = 0.0;

    <span class="keywordflow">if</span> ((it = params.find(<span class="stringliteral">&quot;seed&quot;</span>)) != params.end()) {
        srand( ParameterMap::mapped_type(it-&gt;second).longValue() );
    }
    <span class="keywordflow">if</span> ((it = params.find(<span class="stringliteral">&quot;fadingPaths&quot;</span>)) != params.end()) {
        <a class="code" href="a00114.html#ad28b3b2fd11307bf33869c5bbdd27a95" title="Number of fading paths used.">fadingPaths</a> = ParameterMap::mapped_type(it-&gt;second).longValue();
    }
    <span class="keywordflow">else</span> {
        bInitSuccess = <span class="keyword">false</span>;
        opp_warning(<span class="stringliteral">&quot;No fadingPaths defined in config.xml for JakesFading!&quot;</span>);
    }
    <span class="keywordflow">if</span> ((it = params.find(<span class="stringliteral">&quot;delayRMS&quot;</span>)) != params.end()) {
        delayRMS = ParameterMap::mapped_type(it-&gt;second).doubleValue();
    }
    <span class="keywordflow">else</span> {
        bInitSuccess = <span class="keyword">false</span>;
        opp_warning(<span class="stringliteral">&quot;No delayRMS defined in config.xml for JakesFading!&quot;</span>);
    }
    <span class="keywordflow">if</span> ((it = params.find(<span class="stringliteral">&quot;interval&quot;</span>)) != params.end()) {
        <a class="code" href="a00114.html#aa15d56a2dadede1a0432103d60d6d927" title="The interval to set attenuation entries in.">interval</a> = <a class="code" href="a00013.html" title="Defines an argument for a mapping.">Argument</a>(ParameterMap::mapped_type(it-&gt;second).doubleValue());
    }
    <span class="keywordflow">else</span> {
        bInitSuccess = <span class="keyword">false</span>;
        opp_warning(<span class="stringliteral">&quot;No interval defined in config.xml for JakesFading!&quot;</span>);
    }
    <span class="keywordflow">if</span> ((it = params.find(<span class="stringliteral">&quot;carrierFrequency&quot;</span>)) != params.end()) {
        <a class="code" href="a00114.html#a8c91a22de8e520176877f7421d033ae7" title="Carrier frequency to be used.">carrierFrequency</a> = ParameterMap::mapped_type(it-&gt;second).doubleValue();
    }
    <span class="keywordflow">else</span> {
        bInitSuccess = <span class="keyword">false</span>;
        opp_warning(<span class="stringliteral">&quot;No carrierFrequency defined in config.xml for JakesFading!&quot;</span>);
    }
    <span class="keywordflow">if</span> (bInitSuccess) {
  <a class="code" href="a00114.html#a7f9a358fb5cdfd19e6d1e7c97627ad4f" title="Angle of arrival on a fading path used for Doppler shift calculation.">angleOfArrival</a> = <span class="keyword">new</span> <span class="keywordtype">double</span>[<a class="code" href="a00114.html#ad28b3b2fd11307bf33869c5bbdd27a95" title="Number of fading paths used.">fadingPaths</a>];
  <a class="code" href="a00114.html#a2f0c52cb4f441a2abba9aec17194fb66" title="Delay on a fading path.">delay</a> = <span class="keyword">new</span> simtime_t[<a class="code" href="a00114.html#ad28b3b2fd11307bf33869c5bbdd27a95" title="Number of fading paths used.">fadingPaths</a>];

  <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i &lt; <a class="code" href="a00114.html#ad28b3b2fd11307bf33869c5bbdd27a95" title="Number of fading paths used.">fadingPaths</a>; ++i) {
    <a class="code" href="a00114.html#a7f9a358fb5cdfd19e6d1e7c97627ad4f" title="Angle of arrival on a fading path used for Doppler shift calculation.">angleOfArrival</a>[i] = cos(uniform(0, M_PI));
    <a class="code" href="a00114.html#a2f0c52cb4f441a2abba9aec17194fb66" title="Delay on a fading path.">delay</a>[i] = exponential(delayRMS);
  }
    }
    <span class="keywordflow">return</span> <a class="code" href="a00114.html#a5195d855a7219f5c3c4a953997b37084" title="Initialize the analog model from XML map data.">AnalogueModel::initFromMap</a>(params) &amp;&amp; bInitSuccess;
}
</pre></div>
</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>D:/Projects/MiXiM/extsrc/mixim/src/modules/analogueModel/<a class="el" href="a00398_source.html">JakesFading.h</a></li>
<li>D:/Projects/MiXiM/extsrc/mixim/src/modules/analogueModel/JakesFading.cc</li>
</ul>
</div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><a class="el" href="a00114.html">JakesFading</a>      </li>

    <li class="footer">Generated on Tue Mar 5 2013 21:26:32 for MiXiM by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.5.1 </li>
   </ul>
 </div>


</body>
</html>
